﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace WpfBitsLib
{
    public class Helper : WpfBitsLib.IHelper
    {
        private string _Comment = "A bird cannot fly backwards";
 
        #region IHelper Members
        public string MyDateTime 
        {
            get
            {
                return DateTime.Now.ToString();
            }
        }

        public string MyProgrammer
        {
            get { return "Andrew van Dijk" ; }
        }

        public string Comment
        {
            get { return _Comment; }
            set { _Comment=value; }
        }


        public DataTable Stuff
        {//110037320
            get {
                DataTable dt=null;
                try
                {
                    using (SqlConnection cn = new SqlConnection("Data Source=.;Initial Catalog=OLG;user id=sa;"))
                    {
                        cn.Open();
                        SqlDataAdapter da = new SqlDataAdapter("exec SInfoLoadStudentExam 110007788", cn);
                        DataSet ds = new DataSet();
                        da.Fill(ds);

                        dt = ds.Tables[0];
                        cn.Close();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                return dt;

            }
        }


        public DataTable LoadStudentAssignments
        {//110037320
            get {
                DataTable dt=null;
                try
                {
                    using (SqlConnection cn = new SqlConnection("Data Source=.;Initial Catalog=OLG;user id=sa;"))
                    {
                        cn.Open();
                        SqlDataAdapter da = new SqlDataAdapter("exec SInfoLoadStudentAssign 110007788", cn);
                        DataSet ds = new DataSet();
                        da.Fill(ds);

                        dt = ds.Tables[0];
                        cn.Close();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
                return dt;

            }
        }
#endregion




      
    }
}
